home *** CD-ROM | disk | FTP | other *** search
/ A.C.E. 2 / ACE CD 2.iso / FILES / UTILS / AMOSPRO6.DMS / in.adf / Procedures / Fractals / _Quatrals.AMOS / _Quatrals.amosSourceCode
Encoding:
AMOS Source Code  |  1992-09-29  |  3.0 KB  |  108 lines

  1. '******************************************************* 
  2. '*                                                     * 
  3. '* AMOS Professional Procedure Library                 * 
  4. '*                                                     * 
  5. '* Procedure: Quatratic curve fractals                 *   
  6. '*                                                     * 
  7. '*    Author: Hedwig Janssens                          *   
  8. '*                                                     * 
  9. '******************************************************* 
  10. '
  11. ' Instructions 
  12. ' ------------ 
  13.  
  14. ' Press any key to move onto next fractal example and use
  15. ' the mouse buttons to rotate the screen colours.
  16. '
  17.  Screen Open 0,320,256,32,LORES : Flash Off : Curs Off 
  18. Do 
  19. '------------------  Calculate palette --------------------
  20.    Shift Off : Cls 0
  21.    For X=0 To 15 : Colour X,X*256+X*16+X*0.8 : Next X
  22.    For X=16 To 31 : C=31-X : Colour X,C*256+C*16+C*0.8 : Next X
  23. '------------------ Read data and plot fractal ------------    
  24.    Read G,Z,T
  25.    _QUATALS[G,G,G,G,Z,T]
  26. '------------------ Fill entire screen --------------------      
  27.    GZ=G*2-1
  28.    For X=0 To 320/(G*2) : For Y=0 To 256/(G*2)
  29.          Screen Copy 0,0,0,GZ,GZ To 0,X*GZ,Y*GZ
  30.    Next Y : Next X
  31. '------------------ Test mouse keys and color cycling -----  
  32.    Clear Key : MO=2
  33.    Repeat 
  34.       MO=Mouse Key
  35.       If MO=1 : Shift Down 5,0,31,1 : End If 
  36.       If MO=2 : Shift Up 5,0,31,1 : End If 
  37.       If MO=3 : Shift Off : End If 
  38.    Until Inkey$<>""
  39. Loop 
  40. End 
  41. '
  42. '----------------- Some examples.  Data size,zoom,type ----    
  43. Data 64,398,2
  44. Data 16,5,6
  45. Data 32,212,5
  46. Data 32,11,5
  47. Data 32,100,4
  48. Data 16,17,6
  49. Data 32,1111,3
  50. Data 32,124,3
  51. Data 32,8,1
  52. Data 64,641,1
  53. Data 64,6,2
  54. Data 32,9,4
  55. Data 32,24,3
  56. Data 128,5094,3
  57. '
  58. Procedure _QUATALS[XC,YC,XW,YH,Z,T]
  59.    '  
  60.    ' Inputs:  XC,YC Center coordinates
  61.    '          XW Fractal width  
  62.    '          Yh Fractal height   
  63.    '          Z  Zoom factor (Value depends on type)  
  64.    '          T  fractal type (1-6) 
  65.    ' Outputs: Plots to current screen 
  66.    '
  67.    If XC-XW<0 or XC+XW>Screen Width Then Pop Proc
  68.    If YC-YW<0 or YC+YW>Screen Height Then Pop Proc
  69.    XX=0 : YY=0 : CMAX=Screen Colour-1
  70.    '
  71.    If T=1
  72.       For Y=-YH To YH : For X=-XW To XW
  73.             Plot XC+X,YC+Y,(((X*X+Y*Y)*Z)/100) and CMAX
  74.       Next X : Next Y
  75.    End If 
  76.    '
  77.    If T=2
  78.       For Y=-YH To YH : For X=-XW To XW
  79.             Plot XC+X,YC+Y,(((X*X-Y*Y)*Z)/100) and CMAX
  80.       Next X : Next Y
  81.    End If 
  82.    '
  83.    If T=3
  84.       For Y=-YH To YH : For X=-XW To XW
  85.             XX=XX+X-Int(X/10)*10
  86.             Plot XC+X,YC+Y,(((XX+YY)*Z)/100) and CMAX
  87.          Next X : YY=YY+Y-Int(Y/10)*10
  88.       Next Y
  89.    End If 
  90.    '
  91.    If T=4
  92.       For Y=-YH To YH : For X=-XW To XW
  93.             Plot XC+X,YC+Y,(((X*X*Y+X*Y*Y)*Z)/1000) and CMAX
  94.       Next X : Next Y
  95.    End If 
  96.    '
  97.    If T=5
  98.       For Y=-YH To YH : For X=-XW To XW
  99.             Plot XC+X,YC+Y,((X*X*Y*Y)/Z) and CMAX
  100.       Next X : Next Y
  101.    End If 
  102.    '
  103.    If T=6
  104.       For Y=-YH To YH : For X=-XW To XW
  105.             Plot XC+X,YC+Y,(X*Y*Z) and CMAX
  106.       Next X : Next Y
  107.    End If 
  108. End Proc